class BaseModule {
    constructor(data, message) {
        if (typeof data === 'string') {
            message = data;
            data = null;
        }
        this.data = data

        this.message = message || '操作成功'
    }
}

class SuccessModule extends BaseModule {
    constructor(data, message) {
        super(data, message)
        this.code = 200
    }
}

class ErrorModule extends BaseModule {
    constructor(data, message) {
        super(data, message)
        this.code = -1
    }
}

module.exports = {
    SuccessModule,
    ErrorModule
}